<!DOCTYPE html>
<html lang="en">
  <head>
    <title>PostgresDate Structure Reference</title>
    <link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
    <link rel="stylesheet" type="text/css" href="../css/highlight.css" />
    <meta charset='utf-8'>
	<meta name="viewport" content="width=device-width, viewport-fit=cover, initial-scale=1.0" />
    <script src="../js/jquery.min.js" defer></script>
    <script src="../js/jazzy.js" defer></script>
    
  </head>
  <body>
    <a name="//apple_ref/swift/Struct/PostgresDate" class="dashAnchor"></a>
    <a title="PostgresDate Structure Reference"></a>
    <header>
      <div class="content-wrapper">
        <p>
          <a href="../index.html">PostgresClientKit Docs</a>
          <span class="no-mobile"> (100% documented)</span>
        </p>
    
        <p class="header-right">
          <a href="https://github.com/codewinsdotcom/PostgresClientKit">
            <img src="../img/gh.png"/>
            <span class="no-mobile">View on GitHub</span>
          </a>
        </p>
    
      </div>
    </header>
    <div id="breadcrumbs-container">
      <div class="content-wrapper">
        <p id="breadcrumbs">
          <span class="no-mobile">
            <a href="../index.html">PostgresClientKit Reference</a>
            <img id="carat" src="../img/carat.png" />
          </span>
          PostgresDate Structure Reference
        </p>
      </div>
    </div>
    <div class="wrapper">
      <div class="article-wrapper">
        <article class="main-content">
          <section>
            <section class="section">
              <h1>PostgresDate</h1>
                <div class="declaration">
                  <div class="language">
                    <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">PostgresDate</span><span class="p">:</span>
    <span class="kt"><a href="../Protocols/PostgresValueConvertible.html">PostgresValueConvertible</a></span><span class="p">,</span> <span class="kt">Equatable</span><span class="p">,</span> <span class="kt">Decodable</span><span class="p">,</span> <span class="kt">CustomStringConvertible</span></code></pre>

                  </div>
                </div>
              <p>Represents a Postgres <code>DATE</code> value, which consists of the following components:</p>

<ul>
<li>year</li>
<li>month</li>
<li>day</li>
</ul>

<p>For example, <code>2019-03-14</code>.</p>

            </section>
            <section class="section task-group-section">
              <div class="task-group">
                <ul>
                  <li class="item">
                    <div>
                      <code>
                      <a name="/s:17PostgresClientKit0A4DateV4year5month3dayACSgSi_S2itcfc"></a>
                      <a name="//apple_ref/swift/Method/init(year:month:day:)" class="dashAnchor"></a>
                      <a class="token" href="#/s:17PostgresClientKit0A4DateV4year5month3dayACSgSi_S2itcfc">init(year:month:day:)</a>
                      </code>
                    </div>
                    <div class="height-container">
                      <div class="pointer-container"></div>
                      <section class="section">
                        <div class="pointer"></div>
                        <div class="abstract">
                          <p>Creates a <code>PostgresDate</code> from components.</p>

<p>For example, to represent <code>2019-03-14</code>:</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">date</span> <span class="o">=</span> <span class="kt">PostgresDate</span><span class="p">(</span><span class="nv">year</span><span class="p">:</span> <span class="mi">2019</span><span class="p">,</span>
                        <span class="nv">month</span><span class="p">:</span> <span class="mi">3</span><span class="p">,</span>
                        <span class="nv">day</span><span class="p">:</span> <span class="mi">14</span><span class="p">)</span>
</code></pre>

                        </div>
                        <div class="declaration">
                          <h4>Declaration</h4>
                          <div class="language">
                            <p class="aside-title">Swift</p>
                            <pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">?(</span><span class="nv">year</span><span class="p">:</span> <span class="kt">Int</span><span class="p">,</span>
             <span class="nv">month</span><span class="p">:</span> <span class="kt">Int</span><span class="p">,</span>
             <span class="nv">day</span><span class="p">:</span> <span class="kt">Int</span><span class="p">)</span></code></pre>

                          </div>
                        </div>
                        <div>
                          <h4>Parameters</h4>
                          <table class="graybox">
                            <tbody>
                              <tr>
                                <td>
                                  <code>
                                  <em>year</em>
                                  </code>
                                </td>
                                <td>
                                  <div>
                                    <p>the year value</p>
                                  </div>
                                </td>
                              </tr>
                              <tr>
                                <td>
                                  <code>
                                  <em>month</em>
                                  </code>
                                </td>
                                <td>
                                  <div>
                                    <p>the month value (1 for January, 2 for February, and so on)</p>
                                  </div>
                                </td>
                              </tr>
                              <tr>
                                <td>
                                  <code>
                                  <em>day</em>
                                  </code>
                                </td>
                                <td>
                                  <div>
                                    <p>the day value</p>
                                  </div>
                                </td>
                              </tr>
                            </tbody>
                          </table>
                        </div>
                      </section>
                    </div>
                  </li>
                  <li class="item">
                    <div>
                      <code>
                      <a name="/s:17PostgresClientKit0A4DateV4date2inAC10Foundation0D0V_AF8TimeZoneVtcfc"></a>
                      <a name="//apple_ref/swift/Method/init(date:in:)" class="dashAnchor"></a>
                      <a class="token" href="#/s:17PostgresClientKit0A4DateV4date2inAC10Foundation0D0V_AF8TimeZoneVtcfc">init(date:in:)</a>
                      </code>
                    </div>
                    <div class="height-container">
                      <div class="pointer-container"></div>
                      <section class="section">
                        <div class="pointer"></div>
                        <div class="abstract">
                          <p>Creates a <code>PostgresDate</code> by interpreting a <code>Date</code> in a specified time zone to obtain the
year, month, and day components, and discarding the hour, minute, second, and fractional
second components.</p>

<p>(Foundation <code>Date</code> instances represent moments in time, not <em>(year, month, day)</em> tuples.)</p>

                        </div>
                        <div class="declaration">
                          <h4>Declaration</h4>
                          <div class="language">
                            <p class="aside-title">Swift</p>
                            <pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">date</span><span class="p">:</span> <span class="kt">Date</span><span class="p">,</span> <span class="k">in</span> <span class="nv">timeZone</span><span class="p">:</span> <span class="kt">TimeZone</span><span class="p">)</span></code></pre>

                          </div>
                        </div>
                        <div>
                          <h4>Parameters</h4>
                          <table class="graybox">
                            <tbody>
                              <tr>
                                <td>
                                  <code>
                                  <em>date</em>
                                  </code>
                                </td>
                                <td>
                                  <div>
                                    <p>the moment in time</p>
                                  </div>
                                </td>
                              </tr>
                              <tr>
                                <td>
                                  <code>
                                  <em>timeZone</em>
                                  </code>
                                </td>
                                <td>
                                  <div>
                                    <p>the time zone in which to interpret that moment</p>
                                  </div>
                                </td>
                              </tr>
                            </tbody>
                          </table>
                        </div>
                      </section>
                    </div>
                  </li>
                  <li class="item">
                    <div>
                      <code>
                      <a name="/s:17PostgresClientKit0A4DateVyACSgSScfc"></a>
                      <a name="//apple_ref/swift/Method/init(_:)" class="dashAnchor"></a>
                      <a class="token" href="#/s:17PostgresClientKit0A4DateVyACSgSScfc">init(_:)</a>
                      </code>
                    </div>
                    <div class="height-container">
                      <div class="pointer-container"></div>
                      <section class="section">
                        <div class="pointer"></div>
                        <div class="abstract">
                          <p>Creates a <code>PostgresDate</code> from a string.</p>

<p>The string must conform to the <a href="http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_Patterns">date format pattern</a>
<code>yyyy-MM-dd</code>.  For example, <code>2019-03-14</code>.</p>

                        </div>
                        <div class="declaration">
                          <h4>Declaration</h4>
                          <div class="language">
                            <p class="aside-title">Swift</p>
                            <pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">?(</span><span class="n">_</span> <span class="nv">string</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>

                          </div>
                        </div>
                        <div>
                          <h4>Parameters</h4>
                          <table class="graybox">
                            <tbody>
                              <tr>
                                <td>
                                  <code>
                                  <em>string</em>
                                  </code>
                                </td>
                                <td>
                                  <div>
                                    <p>the string</p>
                                  </div>
                                </td>
                              </tr>
                            </tbody>
                          </table>
                        </div>
                      </section>
                    </div>
                  </li>
                  <li class="item">
                    <div>
                      <code>
                      <a name="/s:17PostgresClientKit0A4DateV14dateComponents10Foundation0dF0Vvp"></a>
                      <a name="//apple_ref/swift/Property/dateComponents" class="dashAnchor"></a>
                      <a class="token" href="#/s:17PostgresClientKit0A4DateV14dateComponents10Foundation0dF0Vvp">dateComponents</a>
                      </code>
                    </div>
                    <div class="height-container">
                      <div class="pointer-container"></div>
                      <section class="section">
                        <div class="pointer"></div>
                        <div class="abstract">
                          <p>A <code>DateComponents</code> value for this <code>PostgresDate</code>.</p>

<p>The returned value has the following components set:</p>

<ul>
<li><code>year</code></li>
<li><code>month</code></li>
<li><code>day</code></li>
</ul>

                        </div>
                        <div class="declaration">
                          <h4>Declaration</h4>
                          <div class="language">
                            <p class="aside-title">Swift</p>
                            <pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">dateComponents</span><span class="p">:</span> <span class="kt">DateComponents</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>

                          </div>
                        </div>
                      </section>
                    </div>
                  </li>
                  <li class="item">
                    <div>
                      <code>
                      <a name="/s:17PostgresClientKit0A4DateV4date2in10Foundation0D0VAF8TimeZoneV_tF"></a>
                      <a name="//apple_ref/swift/Method/date(in:)" class="dashAnchor"></a>
                      <a class="token" href="#/s:17PostgresClientKit0A4DateV4date2in10Foundation0D0VAF8TimeZoneV_tF">date(in:)</a>
                      </code>
                    </div>
                    <div class="height-container">
                      <div class="pointer-container"></div>
                      <section class="section">
                        <div class="pointer"></div>
                        <div class="abstract">
                          <p>Creates a <code>Date</code> by interpreting this <code>PostgresDate</code> in a specified time zone, setting the
hour, minute, second, and fractional second components to 0.</p>

<p>(Foundation <code>Date</code> instances represent moments in time, not <em>(year, month, day)</em> tuples.)</p>

                        </div>
                        <div class="declaration">
                          <h4>Declaration</h4>
                          <div class="language">
                            <p class="aside-title">Swift</p>
                            <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">date</span><span class="p">(</span><span class="k">in</span> <span class="nv">timeZone</span><span class="p">:</span> <span class="kt">TimeZone</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Date</span></code></pre>

                          </div>
                        </div>
                        <div>
                          <h4>Parameters</h4>
                          <table class="graybox">
                            <tbody>
                              <tr>
                                <td>
                                  <code>
                                  <em>timeZone</em>
                                  </code>
                                </td>
                                <td>
                                  <div>
                                    <p>the time zone</p>
                                  </div>
                                </td>
                              </tr>
                            </tbody>
                          </table>
                        </div>
                        <div>
                          <h4>Return Value</h4>
                          <p>the moment in time</p>
                        </div>
                      </section>
                    </div>
                  </li>
                </ul>
              </div>
              <div class="task-group">
                <div class="task-name-container">
                  <a name="/PostgresValueConvertible"></a>
                  <a name="//apple_ref/swift/Section/PostgresValueConvertible" class="dashAnchor"></a>
                  <a href="#/PostgresValueConvertible">
                    <h3 class="section-name">PostgresValueConvertible</h3>
                  </a>
                </div>
                <ul>
                  <li class="item">
                    <div>
                      <code>
                      <a name="/s:17PostgresClientKit0A4DateV13postgresValueAA0aF0Vvp"></a>
                      <a name="//apple_ref/swift/Property/postgresValue" class="dashAnchor"></a>
                      <a class="token" href="#/s:17PostgresClientKit0A4DateV13postgresValueAA0aF0Vvp">postgresValue</a>
                      </code>
                    </div>
                    <div class="height-container">
                      <div class="pointer-container"></div>
                      <section class="section">
                        <div class="pointer"></div>
                        <div class="abstract">
                          <p>A <code><a href="../Structs/PostgresValue.html">PostgresValue</a></code> for this <code>PostgresDate</code>.</p>

                        </div>
                        <div class="declaration">
                          <h4>Declaration</h4>
                          <div class="language">
                            <p class="aside-title">Swift</p>
                            <pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">postgresValue</span><span class="p">:</span> <span class="kt"><a href="../Structs/PostgresValue.html">PostgresValue</a></span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>

                          </div>
                        </div>
                      </section>
                    </div>
                  </li>
                </ul>
              </div>
              <div class="task-group">
                <div class="task-name-container">
                  <a name="/Equatable"></a>
                  <a name="//apple_ref/swift/Section/Equatable" class="dashAnchor"></a>
                  <a href="#/Equatable">
                    <h3 class="section-name">Equatable</h3>
                  </a>
                </div>
                <ul>
                  <li class="item">
                    <div>
                      <code>
                      <a name="/s:17PostgresClientKit0A4DateV2eeoiySbAC_ACtFZ"></a>
                      <a name="//apple_ref/swift/Method/==(_:_:)" class="dashAnchor"></a>
                      <a class="token" href="#/s:17PostgresClientKit0A4DateV2eeoiySbAC_ACtFZ">==(_:_:)</a>
                      </code>
                    </div>
                    <div class="height-container">
                      <div class="pointer-container"></div>
                      <section class="section">
                        <div class="pointer"></div>
                        <div class="abstract">
                          <p>True if <code>lhs.postgresValue == rhs.postgresValue</code>.</p>

                        </div>
                        <div class="declaration">
                          <h4>Declaration</h4>
                          <div class="language">
                            <p class="aside-title">Swift</p>
                            <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="o">==</span> <span class="p">(</span><span class="nv">lhs</span><span class="p">:</span> <span class="kt">PostgresDate</span><span class="p">,</span> <span class="nv">rhs</span><span class="p">:</span> <span class="kt">PostgresDate</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span></code></pre>

                          </div>
                        </div>
                      </section>
                    </div>
                  </li>
                </ul>
              </div>
              <div class="task-group">
                <div class="task-name-container">
                  <a name="/Decodable"></a>
                  <a name="//apple_ref/swift/Section/Decodable" class="dashAnchor"></a>
                  <a href="#/Decodable">
                    <h3 class="section-name">Decodable</h3>
                  </a>
                </div>
                <ul>
                  <li class="item">
                    <div>
                      <code>
                      <a name="/s:Se4fromxs7Decoder_p_tKcfc"></a>
                      <a name="//apple_ref/swift/Method/init(from:)" class="dashAnchor"></a>
                      <a class="token" href="#/s:Se4fromxs7Decoder_p_tKcfc">init(from:)</a>
                      </code>
                    </div>
                    <div class="height-container">
                      <div class="pointer-container"></div>
                      <section class="section">
                        <div class="pointer"></div>
                        <div class="abstract">
                          
                        </div>
                        <div class="declaration">
                          <h4>Declaration</h4>
                          <div class="language">
                            <p class="aside-title">Swift</p>
                            <pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">from</span> <span class="nv">decoder</span><span class="p">:</span> <span class="kt">Decoder</span><span class="p">)</span> <span class="k">throws</span></code></pre>

                          </div>
                        </div>
                      </section>
                    </div>
                  </li>
                </ul>
              </div>
              <div class="task-group">
                <div class="task-name-container">
                  <a name="/CustomStringConvertible"></a>
                  <a name="//apple_ref/swift/Section/CustomStringConvertible" class="dashAnchor"></a>
                  <a href="#/CustomStringConvertible">
                    <h3 class="section-name">CustomStringConvertible</h3>
                  </a>
                </div>
                <ul>
                  <li class="item">
                    <div>
                      <code>
                      <a name="/s:17PostgresClientKit0A4DateV11descriptionSSvp"></a>
                      <a name="//apple_ref/swift/Property/description" class="dashAnchor"></a>
                      <a class="token" href="#/s:17PostgresClientKit0A4DateV11descriptionSSvp">description</a>
                      </code>
                    </div>
                    <div class="height-container">
                      <div class="pointer-container"></div>
                      <section class="section">
                        <div class="pointer"></div>
                        <div class="abstract">
                          <p>A string representation of this <code>PostgresDate</code>.</p>

<p>Equivalent to <code>String(describing: postgresValue)</code>.</p>

                        </div>
                        <div class="declaration">
                          <h4>Declaration</h4>
                          <div class="language">
                            <p class="aside-title">Swift</p>
                            <pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">description</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>

                          </div>
                        </div>
                      </section>
                    </div>
                  </li>
                </ul>
              </div>
            </section>
          </section>
        </article>
      </div>
      <div class="nav-wrapper">
        <nav class="nav-bottom">
          <ul class="nav-groups">
            <li class="nav-group-name">
              <a href="../Classes.html">Classes</a>
              <ul class="nav-group-tasks">
                <li class="nav-group-task">
                  <a href="../Classes/Connection.html">Connection</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Classes/ConnectionPool.html">ConnectionPool</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Classes/ConsoleLogHandler.html">ConsoleLogHandler</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Classes/Cursor.html">Cursor</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Classes/Logger.html">Logger</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Classes/Statement.html">Statement</a>
                </li>
              </ul>
            </li>
            <li class="nav-group-name">
              <a href="../Enums.html">Enumerations</a>
              <ul class="nav-group-tasks">
                <li class="nav-group-task">
                  <a href="../Enums/Credential.html">Credential</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Enums/LogLevel.html">LogLevel</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Enums/PostgresError.html">PostgresError</a>
                </li>
              </ul>
            </li>
            <li class="nav-group-name">
              <a href="../Extensions.html">Extensions</a>
              <ul class="nav-group-tasks">
                <li class="nav-group-task">
                  <a href="../Extensions/Bool.html">Bool</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Extensions/Date.html">Date</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Extensions/Decimal.html">Decimal</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Extensions/Double.html">Double</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Extensions/Int.html">Int</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Extensions/Optional.html">Optional</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Extensions/String.html">String</a>
                </li>
              </ul>
            </li>
            <li class="nav-group-name">
              <a href="../Protocols.html">Protocols</a>
              <ul class="nav-group-tasks">
                <li class="nav-group-task">
                  <a href="../Protocols/ConnectionDelegate.html">ConnectionDelegate</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Protocols/LogHandler.html">LogHandler</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Protocols/PostgresValueConvertible.html">PostgresValueConvertible</a>
                </li>
              </ul>
            </li>
            <li class="nav-group-name">
              <a href="../Structs.html">Structures</a>
              <ul class="nav-group-tasks">
                <li class="nav-group-task">
                  <a href="../Structs/ColumnMetadata.html">ColumnMetadata</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Structs/ConnectionConfiguration.html">ConnectionConfiguration</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Structs/ConnectionPoolConfiguration.html">ConnectionPoolConfiguration</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Structs/ConnectionPoolMetrics.html">ConnectionPoolMetrics</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Structs/LogRecord.html">LogRecord</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Structs/Notice.html">Notice</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Structs/Postgres.html">Postgres</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Structs/PostgresByteA.html">PostgresByteA</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Structs/PostgresDate.html">PostgresDate</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Structs/PostgresTime.html">PostgresTime</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Structs/PostgresTimeWithTimeZone.html">PostgresTimeWithTimeZone</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Structs/PostgresTimestamp.html">PostgresTimestamp</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Structs/PostgresTimestampWithTimeZone.html">PostgresTimestampWithTimeZone</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Structs/PostgresValue.html">PostgresValue</a>
                </li>
                <li class="nav-group-task">
                  <a href="../Structs/Row.html">Row</a>
                </li>
              </ul>
            </li>
          </ul>
        </nav>
      </div>
      <div class="footer-wrapper">
        <section id="footer">
          <p>Copyright 2019 David Pitfield and the PostgresClientKit contributors. Licensed under the Apache License, Version 2.0.</p>
          <p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
        </section>
      </div>
    </div>
  </body>
</div>
</html>
